package InterfaceP;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-04-07
 * Time: 9:39
 * To BE A Better Person-2020-3-2
 */
class Animal{
    public String name;

    public Animal(String name) {
        this.name = name;
    }

    public void Eat(){
        System.out.println(this.name +"正在吃饭");
    }
}
interface IRunning{
    void Run();
}
class Dog extends Animal implements IRunning{

    public Dog(String name) {

        super(name);
        this.name=name;
    }
    public void Run(){

        System.out.println(this.name+"is running");
    }

}
class Human extends Animal implements IRunning{

    public Human(String name) {
        super(name);
        this.name=name;
    }

    @Override
    public void Run() {
        System.out.println(this.name+"is running");
    }
}
public class Demo2 {
    public static void Irun(IRunning running){
        running.Run();
    }
    public static void main(String[] args) {
        Animal animal=new Dog("wang");
        Animal animal1=new Human("krik");
        Dog dog=new Dog("dottie");
        animal.Eat();
        Irun(dog);
        animal1.Eat();
    }
}
